const btn = document.querySelector(' button')
const province = document.querySelector('input[name=province ]')
const city = document.querySelector('input[name=city ]')
const list = document.querySelector('.list')
btn.addEventListener('click', async function () {
  const pname = province.value
  const cname = city.value
  const { data: res } = await axios({
    url: 'http://ajax-api.itheima.net/api/area',
    method: 'GET',
    params: {
      pname,
      cname,
    },
  })
  console.log(res)
  const { data } = res
  list.innerHTML = data
    .map((item) => {
      return `<li> ${item} </li> `
    })
    .join('')
})
